Skip to content

test: de-flake the jspm install-order vendor test (mock the live CDN) - #323

Merged
vivek7405 merged 1 commit into
mainfrom
fix/deflake-jspm-order-test
Jun 3, 2026
Merged

test: de-flake the jspm install-order vendor test (mock the live CDN)#323
vivek7405 merged 1 commit into
mainfrom
fix/deflake-jspm-order-test

Conversation

@vivek7405

Copy link
Copy Markdown
Collaborator

Closes #312

Problem

packages/server/test/vendor/vendor.test.js's jspmGenerate: install order does not affect output hit the live ga.jspm.io CDN twice and deepEquald the results. It flaked roughly 1 run in 4 across this session's PRs: the live CDN occasionally resolved a transitive dep in one ordering but not the other (observed: clsx's transitive), always passing on a plain re-run. A green PR could fail CI for a reason unrelated to the change, and the failure looked like a regression.

Fix

The property under test is OUR per-package resolve + merge being order-independent, not the live CDN's transitive-resolution stability. Mock the api.jspm.io/generate endpoint (via the file's existing withMockedFetch helper, duck-typed like the neighbouring failure-mode tests) so each install resolves to a fixed fragment. The test now asserts jspmGenerate([a, b]) deep-equals jspmGenerate([b, a]) against deterministic fragments, with no network.

Tests

  • The rewritten test passes deterministically (verified 5/5 with WEBJS_SKIP_NETWORK_TESTS=1, proving no live dependency).
  • Full suite: 2025 pass, 0 fail. The remaining live integration is still covered by the other network-gated tests (a real package resolves to a CDN URL, the cache-hit case); only the order-sensitivity assertion moved off the network.

Docs / dogfood: N/A (test-only change, no runtime or public-API surface).

The 'install order does not affect output' test hit ga.jspm.io twice and
deepEqual'd the results, which flaked roughly 1 run in 4: the live CDN
occasionally resolved a transitive dep in one ordering but not the other, so a
green PR could fail CI for reasons unrelated to the change. The property under
test is OUR per-package resolve + merge being order-independent, not the CDN's
live transitive-resolution stability. Mock the generate endpoint so each
install resolves to a fixed fragment, making the test deterministic with no
network. Verified flake-free across repeated runs with network disabled.

Closes #312
@vivek7405 vivek7405 changed the title fix: de-flake the jspm install-order vendor test (mock the live CDN) test: de-flake the jspm install-order vendor test (mock the live CDN) Jun 3, 2026
@vivek7405
vivek7405 merged commit a1d7a16 into main Jun 3, 2026
5 checks passed
@vivek7405
vivek7405 deleted the fix/deflake-jspm-order-test branch June 3, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

De-flake the jspm install-order vendor test (live-CDN dependency)

1 participant